#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
using namespace std;



int main()
{
    ifstream archivo;
    archivo.open("digitos.txt");
    char c;

    int matriz[101][51];
    for (int i = 0; i<=100; i++)
    {

        for (int j = 0; j <= 50; j++)
        {

            archivo.get(c);
            if (static_cast<int>(c) - 48 < 10 and static_cast<int>(c) - 48 > -1) matriz[i][j] = static_cast<int>(c) - 48;



        }

    }
    archivo.close();
/*
    for (int j = 0; j < 100; j++)
    {
        for (int i = 0; i < 50; i++)
        {
            cout << matriz[j][i];
        }
        cout << endl;
    }
*/

int sum[50];
int carry[50];

    for (int j = 49; j>-1;j--)
    {
        sum[j] = 0;
        carry[j] = 0;
        if (j < 49) sum[j] = carry[j+1];
        for (int i = 0; i<100;i++)
        {

            sum[j] = sum[j] + matriz[i][j];


        }
        carry[j] = sum[j]/10;
sum[j] = sum[j] % 10;

    }



for (int i = 49; i> -1; i--)
{
    cout << "suma[" << i << "]      " << sum[i]  <<  "              Carry[" << i << "]       " << carry[i]   << endl;


}




    return 0;
}
